﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _uitwerking__Algoritmiek.AssignementForms
{
    public partial class form_GGD3 : Form
    {
        code_GGD3 algoritme;

        public form_GGD3(code_GGD3 algoritme)
        {
            InitializeComponent();

            this.algoritme = algoritme;

            tb_M.Text = "8";
            tb_M.TextChanged += new EventHandler(tb_Input_TextChanged);
            tb_N.TextChanged += new EventHandler(tb_Input_TextChanged);
            tb_N.Text = "5";
        }

        private void tb_Input_TextChanged(object sender, EventArgs e)
        {
            if (tb_M.Text != "" && tb_N.Text != "")
            {
                if (tb_M.Text != "-" && tb_N.Text != "-")
                {
                    algoritme.bewerkingen = 0;
                    lbl_Output.Text = algoritme.Execute(Convert.ToInt32(tb_M.Text), Convert.ToInt32(tb_N.Text)).ToString();
                    lbl_Tijd.Text = algoritme.bewerkingen + " bewerkingen";
                }
            }
        }
    }
}
